package com.wust.smartcity.autotask.server.core.job;



import com.alibaba.fastjson.JSONObject;
import com.wust.smartcity.autotask.server.core.api.feign.client.DemoService;
import com.wust.smartcity.common.annotations.Job;
import com.wust.smartcity.common.context.DefaultBusinessContext;
import com.wust.smartcity.common.entity.demo.Demo;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * Created by wust on 2019/6/13.
 * 每天凌晨两点触发
 */

@Component
@Job(jobName="demo-job",jobDescription="定期删除垃数据",jobGroupName="sc-admin",cronExpression="0 0 2 * * ?")
public class DemoJob extends BaseJob {

    @Autowired
    DemoService demoService;

    @Override
    public void run(JobExecutionContext jobExecutionContext) {
        DefaultBusinessContext ctx = DefaultBusinessContext.getContext();
        Demo demo = new Demo();
        demoService.select(JSONObject.toJSONString(ctx),demo);
    }
}
